import { ref } from 'vue';
import store from '@/store';
export const useSystemSet = (setPaginationConfig: Fn, setSearchQuery: Fn, getList: PromiseFn) => {
    const system = ref<Nullable<number>>(null);
    // 自定义系统回调
    const sysSetChange = (checkedSystem = null, systemInfo = {}, catalogType = null) => {
        setPaginationConfig({
            current: 1
        });
        // 如果传入catalogType，及左侧树模式
        if (store.getters.userInfo.employeeDTO.isShowSideTree) {
            setSearchQuery({
                catalogCode: checkedSystem,
                catalogType
            });
        } else {
            setSearchQuery({
                system: checkedSystem,
                requestSystem: checkedSystem// 业务需求的system
            });
            system.value = checkedSystem;
        }
        getList();
        console.log(systemInfo);
    };

    return {
        system,
        sysSetChange
    };
};